import { Injectable } from "@angular/core";
import { BaseHttpService } from "../../shared/services/baseHttp.service";
import { HttpClient, HttpParams } from "@angular/common/http";
import { Observable } from 'rxjs/Observable';

@Injectable()
export class ToolsService extends BaseHttpService {
    constructor(private http: HttpClient) {
        super();
    }

    public getServerUrl(): string {
        return this.serverUrl;
    }

    public getLasrCrmSync(): Observable<string> {
        return this.http.get<string>(this.serverUrl + '/claimsserv/api/v1/claims/lastSyncDate');
    }

    public getUploadErrorLogs(): Observable<any[]> {
        return this.http.get<any[]>(this.serverUrl + 'universesserv/api/v1/uploaderrorlogs');
    }

    public isProcessingScheduled(): Observable<any> {
        let params = new HttpParams();
        params = params.set('isProcessing', true.toString());
        return this.http.get<string>(this.serverUrl + 'universesserv/api/v1/files', { params: params });
    }



}